package com.hrm.service.hao;

import com.hrm.dao.hao.DepartmentMapper;
import com.hrm.entity.Dept;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DeptServiceImpl implements DeptService {
    @Autowired
    DepartmentMapper departmentMapper;

    @Override
    public int addDept(Dept department) {
        return departmentMapper.insertDept(department);
    }

    @Override
    public List<Dept> selectDeptList(String name) {
        return departmentMapper.selectDeptList(name);
    }

    /**
     * 通过id删除一个部门
     *
     * @param id
     * @return int
     */
    @Override
    public int deleteDeptById(Integer id) {
        return departmentMapper.deleteDeptById(id);
    }

    /**
     * 修改部门信息
     *
     * @param dept
     * @return int
     */
    @Override
    public int update(Dept dept) {
        return departmentMapper.update(dept);
    }
}
